def is_bracket_sequence_correct(sequence):
    brackets = []
    opening = "([{<"
    closing = ")]}>"
    for bracket in sequence:
        if bracket in opening:
            brackets.append(bracket)
        elif bracket in closing:
            if not brackets or opening.find(brackets[-1]) != closing.find(bracket):
                return False
            brackets.pop()
    return not brackets

sequence = input("Введите скобочную последовательность: ")
is_correct = is_bracket_sequence_correct(sequence)
print("True" if is_correct else "False")
